/**
 * @author: zxb
 * @date: 2024-07-25 
 * @des : 商品路由
 * @router: /goods/add
 **/ 

const Router = require('koa-router');

const { upload, addGoods, updateGoods, deleteGoods, getGoodsDetail, getGoodsList } = require('../controller/goods.controller')
const { validateGoods, PageSizeOrPage } = require('../middleware/goods.middleware')
const { auth, hasAdminPermission } = require('../middleware/auth.middleware')

const router = new Router({ prefix: '/goods' });
router.post('/upload', auth, hasAdminPermission, upload);
router.post('/add', auth, hasAdminPermission, validateGoods, addGoods);
router.post('/update', auth, hasAdminPermission, updateGoods);
router.post('/delete', auth, hasAdminPermission, deleteGoods);
router.post('/detail', getGoodsDetail);
router.post('/list', PageSizeOrPage, getGoodsList);

module.exports = router; // 导出router